export default {
  methods: {
    /**
    * @desc 搜索条件和高级搜索默认条件一致时，不展示保存
    */
    handleShowSave(searchList = [], type = 'product') {
      // 处理默认视图特殊情况
      if (!this.currentView || this.currentView.viewName === '默认视图') {
        return false;
      }

      // 工单切换视角和类型后，默认展示保存，不受到搜索条件改变影响
      if(type === 'task') {
        if(this.isFlagSaveStatus) return true;
      }

      const newSearchList = searchList.map(({ fieldName, operator, timeType, value }) => ({ fieldName, timeType, value, operator }));

      let flag = false;

      if (this.currentView.searchModel.length === searchList.length) {
        for (let i = 0; i < searchList.length; i++) {
          if (JSON.stringify(this.currentView.searchModel[i]) !== JSON.stringify(newSearchList[i])) {
            flag = true;
          }
        }
      } else {
        flag = true;
      }

      return flag;
    },
  }
}